<?php

use yii\grid\GridView;
use common\helpers\Url;
use common\enums\GenderEnum;
use common\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\daterange\DateRangePicker;

$this->title                   = '挂单管理';
$this->params['breadcrumbs'][] = $this->title;
$addon                         = <<< HTML
<span class="input-group-addon">
    <i class="glyphicon glyphicon-calendar"></i>
</span>
HTML;
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">

            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="box-tools">
                    <?= Html::a('Excel 导出订单', ['excel'], ['class' => "btn btn-primary btn-xs"]); ?>
                </div>

            </div>
            <div class="col-sm-12" style="margin-top: 10px;">
                <?php $form = ActiveForm::begin([
                    'action' => Url::to(['index']),
                    'method' => 'get',
                ]); ?>
                <div class="col-sm-4">
                    <div class="input-group drp-container">
                        <?= DateRangePicker::widget([
                            'name'              => 'queryDate',
                            //'value'             => $start_time . '-' . $end_time,
                            'readonly'          => 'readonly',
                            'useWithAddon'      => TRUE,
                            'convertFormat'     => TRUE,
                            'startAttribute'    => 'start_time',
                            'endAttribute'      => 'end_time',
                            //'startInputOptions' => ['value' => $start_time],
                            //'endInputOptions'   => ['value' => $end_time],
                            'pluginOptions'     => [
                                'locale' => ['format' => 'Y-m-d H:i:s'],
                            ],
                        ]) . $addon; ?>
                    </div>
                </div>

                <div class="col-sm-2">
                    <?= Html::textInput('username', '', [
                        'class'       => 'form-control',
                        'id'          => 'test-input',
                        'placeholder' => '请输入要查询的用户名',
                    ]) ?>
                </div>
                <div class="col-sm-3">
                    <div class="input-group">
                        <span class="input-group-btn"><button class="btn btn-white"><i
                                        class="fa fa-search"></i> 搜索</button></span>
                    </div>
                </div>
                <?php ActiveForm::end(); ?>
            </div>

            <!-- /.box-header -->
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel'  => $searchModel,
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover'],
                    'columns'      => [
                        [
                            'class'   => 'yii\grid\SerialColumn',
                            'visible' => FALSE, // 不显示#
                        ],
                        [
                            'attribute' => 'username',
                            'filter'    => FALSE, //不显示搜索框
                            'label'     => '用户名',
                            'value'     => 'member_info.username',
                        ],
                        [
                            'attribute' => 'symbol_cn',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->symbol_cn;
                            },
                        ],
                        [
                            'attribute' => 'contract_size',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->contract_size;
                            },
                        ],
                        // [
                        //     'attribute' => 'open_time',
                        //     'filter'    => FALSE, //不显示搜索框
                        //     'value'     => function ($model) {
                        //         return $model->open_time;
                        //     },
                        // ],
                        [
                            'attribute' => 'price',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->open_price;
                            },
                        ],
                        [
                            'attribute' => 'stop_profit_price',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->stop_profit_price;
                            },
                        ],
                        // [
                        //     'attribute' => 'stop_profit_point',
                        //     'filter'    => FALSE, //不显示搜索框
                        //     'value'     => function ($model) {
                        //         return $model->stop_profit_point;
                        //     },
                        // ],
                        [
                            'attribute' => 'stop_loss_price',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->stop_loss_price;
                            },
                        ],
                        //  [
                        //     'attribute' => 'stop_loss_point',
                        //     'filter'    => FALSE, //不显示搜索框
                        //     'value'     => function ($model) {
                        //         return $model->stop_loss_point;
                        //     },
                        // ],
                        [
                            'attribute' => 'service_fee',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->service_fee;
                            },
                        ],
                        [
                            'attribute' => 'deposit',
                            'filter'    => FALSE, //不显示搜索框
                            'value'     => function ($model) {
                                return $model->deposit;
                            },
                        ],
                        // [
                        //     'attribute' => 'profit',
                        //     'filter'    => FALSE, //不显示搜索框
                        //     'value'     => function ($model) {
                        //         return $model->profit;
                        //     },
                        // ],
                        // [
                        //     'attribute' => 'overfee',
                        //     'filter'    => FALSE, //不显示搜索框
                        // ],
                        //                        [
                        //                            'attribute' => 'state',
                        //                            'value'     => function ($model) {
                        //                                return $model->state;
                        //                            },
                        //                            'filter'    => Html::activeDropDownList($searchModel, 'state',
                        //                                GenderEnum::$listState, [
                        //                                    'prompt' => '全部',
                        //                                    'class'  => 'form-control',
                        //                                ]),
                        // //                        ],
                        // [
                        //     'attribute' => 'close_type',
                        //     'value'     => function ($model) {
                        //         return $model->close_type ?? '';
                        //     },
                        //     'filter'    => false
                        // ],
                    ],
                ]); ?>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
    </div>
</div>





